<template>
  <div class="detile1">
    <ul class="detile">
      <li class="detileBottom" @click="selectAllMusic">
        <div class="detileIcon"></div>
        <div class="detileDsb">播放全部</div>
      </li>
      <li v-for="value in playlist" :key="value.id" class="item" @click="setMusic(value.id)">
        <h3>{{value.name}}</h3>
        <p>{{value.al.name}}---{{value.ar[0].name}}</p>
      </li>
    </ul>
  </div>
</template>

<script>
import { mapActions } from 'vuex'
export default {
  name: 'DetileBottom',
  props: {
    playlist: {
      type: Array,
      default: () => [],
      required: true
    }
  },
  methods: {
    ...mapActions([
      'setFullScreen',
      'setminiplay',
      'setsongs'
    ]),
    setMusic (id) {
      this.setFullScreen(true)
      this.setminiplay(false)
      this.setsongs([id])
    },
    selectAllMusic () {
      this.setFullScreen(true)
      const ids = this.playlist.map(function (item) {
        return item.id
      })
      this.setsongs([ids])
    }
  }
}
</script>

<style scoped lang="scss">
  @import "../../assets/css/variable";
  @import "../../assets/css/mixin";
.detile1{
  width: 100%;
  .detile{
    width: 100%;
    li{
      width: 100%;
      height: 100px;
      padding: 20px;
      box-sizing: border-box;
      @include bg_sub_color();
      border-bottom: 1px solid #ccc;
    }
    .detileBottom{
      display: flex;
      align-items: center;
      border-top-right-radius:50px ;
      border-top-left-radius:50px ;
      .detileIcon{
        width: 60px;
        height: 60px;
        @include bg_img('../../assets/images/small_play');
      }
      .detileDsb{
        @include font_color();
        @include font_size($font_large);
      }
    }
    .item{
      h3{
        @include font_color();
        @include font_size($font_medium)
      }
      p{
        @include font_color();
        @include font_size($font_samll);
        margin-top: 10px;
        opacity: 0.8;
      }
    }
  }
}

</style>
